capture log close
clear all
set maxvar 30000
set more off
pause off
# delimit;

local crime "";
local output "";

/* 
Table B20
Cost-benefit analysis: corrections cost of crime
*/


/* ****************************** */
/* **** GET THE IV ESTIMATES **** */
/* ****************************** */

use "`crime'/prworacombsib_bw264_crime_poly1allcov_iv_all.dta" ;
		
keep if inlist(variables,"ca_crime2shinc2017_1997_2017","ca_crime2sjail2017_1997_2017","ca_crime2sprob2017_1997_2017","ca_crime2spar2017_1997_2017");	

gen order=1 if variables=="ca_crime2shinc2017_1997_2017";
replace order=2 if variables=="ca_crime2sjail2017_1997_2017";
replace order=3 if variables=="ca_crime2sprob2017_1997_2017";
replace order=4 if variables=="ca_crime2spar2017_1997_2017";

sort order;

replace variables="Total days in prison" if variables=="ca_crime2shinc2017_1997_2017";
replace variables="Total days in jail" if variables=="ca_crime2sjail2017_1997_2017";
replace variables="Total days on probation" if variables=="ca_crime2sprob2017_1997_2017";
replace variables="Total days on parole" if variables=="ca_crime2spar2017_1997_2017";

keep variables n_age18unfav;

format n_age18unfav %3.2f;

rename n_age18unfav IV_estimate;


export excel using "`output'/tabB20.xls", firstrow(variables) ;

